{extend name='extra@admin/content'}
{block name="button"}
{if condition="!empty($material)"}
<button type="button"  href="javascript:void(0)" class='layui-btn layui-btn-small ' >
     {$material.name}
</button>
<button type="button"  href="javascript:void(0)" class='layui-btn layui-btn-small ' >
     当前库存：{$material.stock} /{$material.unit}
</button>
{/if}
<div class="nowrap pull-right" style="margin-top:10px">
    {if auth("$classuri/material_stock_log")}
        <button data-open='{:url("$classuri/material_stock_log")}?id={$material.id}' href="javascript:void(0)" class="layui-btn layui-btn-small" style="text-decoration:none">
            全部
        </button>
    {/if}
    {if auth("$classuri/material_stock_log")}
        <hutton data-open='{:url("$classuri/material_stock_log")}?sign=1&id={$material.id}' href="javascript:void(0)" class="layui-btn layui-btn-small" style="text-decoration:none">
            进货
        </hutton>
    {/if}
    {if auth("$classuri/material_stock_log")}
        <hutton data-open='{:url("$classuri/material_stock_log")}?sign=2&id={$material.id}' href="javascript:void(0)" class="layui-btn layui-btn-small" style="text-decoration:none">
            生产
        </hutton>
    {/if}
    {if auth("$classuri/material_stock_log")}
        <hutton data-open='{:url("$classuri/material_stock_log")}?sign=3&id={$material.id}' href="javascript:void(0)" class="layui-btn layui-btn-small" style="text-decoration:none">
            报损
        </hutton>
    {/if}
    <!-- {if auth("$classuri/material_stock_log")}
        <a href='{:url("$classuri/export_material_stock_log")}?id={$material.id}&date={$Think.get.date|default=""}' class="layui-btn layui-btn-small" style="text-decoration:none"><i class="fa fa-mail-forward"></i>
            导出
        </a>
    {/if} -->
</div>
{/block}
{block name="content"}
<!-- 表单搜索 开始 -->
<form class="animated form-search" action="__SELF__" onsubmit="return false" method="get">
        <div class="col-xs-2">
            <div class="form-group">
                <select name="id"  lay-filter="export" class="input-sm form-control">
                    <option value="">- 选择原料 -</option>
                    {foreach s_material as $v1}
                    <option value="{$v1.id}" {if $id eq $v1.id} selected {/if}>- {$v1.name} -</option>
                    {/foreach}
                </select>
            </div>
        </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">处理时间</label>
        <div class="layui-input-inline">
            <input name="date" id='range-date' value="{$Think.get.date|default=''}"
                   placeholder="请选择处理时间" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
</form>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action"/>
    <table class="layui-table" lay-skin="line" lay-size="sm">
        <thead>
            <tr>
                <th class='list-table-check-td'>
                    <input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
                </th>
                <th class='text-left nowrap'>原料名称</th>
                <th class='text-left nowrap'>处理时间</th>
                <th class='text-left nowrap'>变更类型</th>
                <th class='text-left nowrap'>变更数量</th>
                <th class='text-left nowrap'>实际变更</th>
                <th class='text-left nowrap'>差异数</th>
                <th class='text-left nowrap'>当前库存</th>
                <!--<th class='text-left nowrap'>单价</th>-->
                <!--<th class='text-left nowrap'>小计</th>-->
            </tr>
        </thead>
        <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td'>
                    <input class="list-check-box" value='{$vo.id}' type='checkbox'/>
                </td>
                <td class='text-left nowrap'>
                    {$vo.name}
                </td>
                <td class='text-left nowrap'>
                    {$vo.receive_time|date="Y-m-d",###}
                </td>
                <td class='text-left nowrap'>
                    {if condition="$vo.sign eq 1"}
                    进货
                    {elseif condition="$vo.sign eq 2"}
                    生产
                    {/if}
                </td>
                <td class='text-left nowrap'>
                    {$vo.del_num}
                </td>
                <td class='text-left nowrap'>
                    {$vo.res_num}
                </td>
                <td class='text-left nowrap'>
                    {$vo.dif_num}
                </td>
                <td class='text-left nowrap'>
                    {$vo.cur_num}
                </td>
                <!--<td class='text-left nowrap'>-->
                    <!--{$vo.signal_price}-->
                <!--</td>-->
                <!--<td class='text-left nowrap'>-->
                    <!--{$vo.price}-->
                <!--</td>-->
            </tr>
            {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page}</p>{/if}
    {/if}
    <script>
        window.laydate.render({range: true, elem: '#range-date', format: 'yyyy/MM/dd'});
    </script>
</form>
{/block}